<?php

/*
 * CopyRight  : (C)2012-2099 HaoTeam Inc.
 * Document   : WechatAppAddonsConfig.php
 * Created on : 2021-2-27 17:16:50
 * Author     : Tiger <1192851302@qq.com>
 * Description: This is NOT a freeware, use is subject to license terms.
 *              这即使是一个免费软件,使用时也请遵守许可证条款,得到当时人书面许可.
 *              未经书面许可,不得翻版,翻版必究;版权归属 HaoTeam Inc;
 */

namespace app\api\model;

use think\Model;

/**
 * 
 * Class WechatAppAddonsConfig
 * Tiger <1192851302@qq.com> 2021-2-27 17:16:50
 */
class WechatAppAddonsConfig extends Model {

    /**
     * 获取单个配置
     * @author Tiger <1192851302@qq.com>
     * @param int $mid
     * @param string $key
     * @return string
     */
    public static function getOne($key) {
        $item = json_decode(self::where(['mid' => request()->mid(), 'addon' => request()->addon()])->value('config'), true);
        return $item[$key];
    }

    /**
     * 获得多个参数
     * @author Tiger <1192851302@qq.com>
     * @param int $mid
     * @param string $keys
     * @return array
     */
    public static function getMore() {
        return json_decode(self::where(['mid' => request()->mid(), 'addon' => request()->addon()])->value('config'), true);
    }

}
